@extends('adminHead')
@section('title','配置')
@section('rightContent')
    <link href="/admin/assets/plugins/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet" />
    <link href="/admin/assets/plugins/switchery/dist/switchery.min.css" rel="stylesheet" />
    <link href="/admin/assets/plugins/multiselect/css/multi-select.css"  rel="stylesheet" type="text/css" />
    <link href="/admin/assets/plugins/select2/select2.css" rel="stylesheet" type="text/css" />
    <link href="/admin/assets/plugins/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet" />
    <div class="content-page">
        <!-- Start content -->
        <div class="content">
            <div class="container">
    <div class="row">
        <div class="col-sm-12">
            <h4 class="page-title">配置</h4>
            <ol class="breadcrumb">
                <li>
                    <a href="/admin/companySettingsList">首页</a>
                </li>
                <li>
                    <a href="/admin/companySettingsAdd">公司设置</a>
                </li>
                <li class="active">
                    配置
                </li>
            </ol>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="card-box">
                @if (count($errors) > 0)
                    <div class="alert alert-danger">
                        <ul>
                            @foreach ($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                <form class="form-horizontal" action="/admin/companySettingsSave"  data-parsley-validate novalidate method="post" role="form">
                    <input type="hidden" name="_token" value="{{csrf_token()}}"/>
                    <div class="form-group">
                        <label class="col-md-2 control-label">公司名称*</label>
                        <div class="col-md-8">
                            <input type="text" name="title" class="form-control" placeholder="公司名称" value="{{$data['model']['title']}}" required oninvalid="setCustomValidity('请填写公司名称！')"  oninput="setCustomValidity('')" autocomplete="off" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">选择类别*</label>
                        <div class="col-md-8">
                            <div class="radio radio-success radio-inline">
                                <input type="radio" id="is_x_2" value="1" name="type" @if($data['model']['type'] != 2) checked @endif>
                                <label for="is_x_2">类别1</label>
                            </div>
                            <div class="radio radio-success radio-inline">
                                <input type="radio" id="is_x_1" value="2" name="type" @if($data['model']['type'] == 2) checked @endif>
                                <label for="is_x_1">类别2</label>
                            </div>
                        </div>
                        <div class="col-md-12" style="padding-top: 5px">
                            <div class="col-md-2"></div>
                            <div class="col-md-8">
                                <span style="color: red; font-size: 10px; ">#若根据是否有车船费来判断签单保费为交强险费还是商业险费，请选择类别2</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">配置列*</label>
                        <div class="col-md-1">
                            <input type="text" name="number" class="form-control" placeholder="保单号" value="{{$data['model']['number']}}" />
                        </div>
                        <div class="col-md-1">
                            <input type="text" name="license_plate_number" class="form-control" placeholder="车牌号" value="{{$data['model']['license_plate_number']}}" />
                        </div>
                        <div class="col-md-1">
                            <input type="text" name="policy_holder" class="form-control" placeholder="投保人" value="{{$data['model']['policy_holder']}}" />
                        </div>
                        <div class="col-md-1">
                            <input type="text" name="insured" class="form-control" placeholder="被保人" value="{{$data['model']['insured']}}" />
                        </div>
                        <div class="col-md-1">
                            <input type="text" name="vehicles_vessels" class="form-control" placeholder="车船税" value="{{$data['model']['vehicles_vessels']}}" />
                        </div>
                        <div>
                            <div class="type1" style="display: @if($data['model']['type'] == 1) block @else none @endif">
                                <div class="col-md-1">
                                    <input type="text" name="compulsory_insurance" class="form-control" placeholder="交强险保费" value="{{$data['model']['compulsory_insurance']}}" />
                                </div>
                                <div class="col-md-1">
                                    <input type="text" name="commercial_insurance" class="form-control" placeholder="商业保费" value="{{$data['model']['commercial_insurance']}}" />
                                </div>
                            </div>
                            <div class="type2" style="display: @if($data['model']['type'] != 1) block @else none @endif">
                                <div class="col-md-2">
                                    <input type="text" name="written_premium" class="form-control" placeholder="签单保费" value="{{$data['model']['written_premium']}}" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">账号状态</label>
                        <div class="col-md-8">
                            <select  class="selectpicker" data-style="btn-white" name="state">
                                @if($data['model']['state'] != 2)
                                    <option value="1">开启</option>
                                    <option value="2">禁用</option>
                                @else
                                    <option value="1">开启</option>
                                    <option value="2" selected>禁用</option>
                                @endif
                            </select>
                        </div>
                    </div>
                    @if(count($data['model']) > 0)
                        <input type="hidden" name="id" value="{{$data['model']['id']}}" />
                        @endif
                    <div class="form-group">
                        <label class="col-md-2 control-label"></label>
                        <div class="col-md-8">
                            <button class="btn btn-success" id="form">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
            </div>
        </div>
    </div>
    <script>
      var resizefunc = [];
    </script>

    <!-- jQuery  -->
    <script src="/admin/assets/js/jquery.min.js"></script>
    <script src="/admin/assets/js/bootstrap.min.js"></script>
    <script src="/admin/assets/js/detect.js"></script>
    <script src="/admin/assets/js/fastclick.js"></script>
    <script src="/admin/assets/js/jquery.slimscroll.js"></script>
    <script src="/admin/assets/js/jquery.blockUI.js"></script>
    <script src="/admin/assets/js/waves.js"></script>
    <script src="/admin/assets/js/wow.min.js"></script>
    <script src="/admin/assets/js/jquery.nicescroll.js"></script>
    <script src="/admin/assets/js/jquery.scrollTo.min.js"></script>

    {{--<script src="/admin/assets/plugins/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>--}}
    {{--<script src="/admin/assets/plugins/switchery/dist/switchery.min.js"></script>--}}
    <script type="text/javascript" src="/admin/assets/plugins/multiselect/js/jquery.multi-select.js"></script>
    <script type="text/javascript" src="/admin/assets/plugins/jquery-quicksearch/jquery.quicksearch.js"></script>
    <script src="/admin/assets/plugins/select2/select2.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-select/dist/js/bootstrap-select.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-select/dist/js/i18n/defaults-zh_CN.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-filestyle/src/bootstrap-filestyle.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-filestyle/src/bootstrap-filestyle.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js" type="text/javascript"></script>
    <script src="/admin/assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/admin/assets/plugins/parsleyjs/dist/parsley.min.js?p=8"></script>
    {{--<script src="/admin/assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>--}}
    {{--<script type="text/javascript" src="/admin/assets/plugins/parsleyjs/dist/parsley.min.js"></script>--}}

    <script src="/admin/assets/js/jquery.core.js"></script>
    <script src="/admin/assets/js/jquery.app.js"></script>

    {{--<script src="/admin/assets/plugins/tinymce/tinymce.min.js"></script>--}}
    <script>
      jQuery(document).ready(function() {
        // Select2
        $(".select2").select2();
        $("input[name=type]").on('change',function () {
          let id = $(this).val()
            $(".type"+id).show().siblings().hide();
        })
        $(".select2-limiting").select2({
          maximumSelectionLength: 2
        });
        // $('form').parsley();
        $('.selectpicker').selectpicker();
        $(":file").filestyle({input: false});
        if($("#elm1").length > 0){
          tinymce.init({
            selector: "textarea#elm1",
            theme: "modern",
            height:300,
            style_formats: [
              {title: 'Bold text', inline: 'b'},
              {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
              {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
              {title: 'Example 1', inline: 'span', classes: 'example1'},
              {title: 'Example 2', inline: 'span', classes: 'example2'},
              {title: 'Table styles'},
              {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
            ]
          });
        }
      });
      // function on_area() {
      //   var $area = $("#area");
      //   $("select[name=city]").next().find('li').on('click',function () {
      //     console.log('a')
      //     var text = trim($(this).find('.text').text());
      //     $.get('/admin/getCity',{text:text},function (res) {
      //       $area.html();
      //       var option = '';
      //       $.each(res,function (index,item) {
      //         option+='<option value="'+item.id+'">'+item.name+'</option>';
      //       });
      //       var str = "<select class='selectpicker bs-select-hidden' data-live-search='true' data-style='btn-white' name='area'>"+option+"</select>"
      //       $area.html(str);
      //       $area.find('select').selectpicker()
      //     })
      //   })
      // }
      function trim(param) {
        return param.replace(/(^\s*)|(\s*$)/g, "");
      }
    </script>

@endsection